﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WEPMlibrary_Model;
using WEPMconnection_DAL;
using PageLibrary1;

namespace WEPMserver_BLL
{
   public class FileBll
    {
       FileDal dal = new FileDal();
       /// <summary>
       /// 上传文件
       /// </summary>
       /// <param name="files"></param>
       /// <returns></returns>
       public int addfile(File files)
       {
           return dal.addFile(files);
       }
       /// <summary>
       /// 分页显示数据
       /// </summary>
       /// <param name="index"></param>
       /// <param name="size"></param>
       /// <returns></returns>
       public Page<File> pageList(int index, int size, string duty)
       {
           Page<File> list = new Page<File>();
           list.pageindex = index;
           list.pagesize = size;
           list.dbcount =(int)Math.Ceiling((double)dal.getCount(duty) / size);
           list.dblist = dal.showFile(index,size,duty);
           return list;
       }
       /// <summary>
       ///根据name找id
       /// </summary>
       /// <param name="username"></param>
       /// <returns></returns>
       public int   findid(string username)
       {
           return dal.findid(username);
       }
       /// <summary>
       ///根据name找duty
       /// </summary>
       /// <param name="username"></param>
       /// <returns></returns>
       public string  duty(int uid)
       {
           return dal.duty(uid);
       }
    }
}
